from common.configration import ConfigHelper, ConfigSections, ConfigKeys
import MySQLdb as mdb

class BaseDataAccess:
    def __init__(self):
        pass;
    
    def new_db_connection(self):
        """Returns a new database connection.
        """
        
        conf = ConfigHelper();
        
        host = conf.get_instance().get(ConfigSections.database, ConfigKeys.host);
        user = conf.get_instance().get(ConfigSections.database, ConfigKeys.user);
        password = conf.get_instance().get(ConfigSections.database, ConfigKeys.password);
        database = conf.get_instance().get(ConfigSections.database, ConfigKeys.database);
        
        connection = mdb.connect(host, user, password, database);
        
        return connection;
